package net.techwatch.gwt.mvp.client;

import com.google.gwt.event.logical.shared.ValueChangeHandler;
import com.google.gwt.event.shared.GwtEvent;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.user.client.ui.HasValue;

public class MockHasValue<T> implements HasValue<T> {

	private T lastValue;
	
	@Override
	public T getValue() {
		return lastValue;
	}

	@Override
	public void setValue(T value) {
		lastValue = value;
	}

	@Override
	public void setValue(T value, boolean fireEvents) {
		setValue(value);
	}

	@Override
	public HandlerRegistration addValueChangeHandler(
			ValueChangeHandler<T> handler) {
		return new HandlerRegistration() {
		
			@Override
			public void removeHandler() {
		
			}
		};
	}

	@Override
	public void fireEvent(GwtEvent<?> event) {

	}

}
